package com.zhipu.balance.pop

import android.widget.Button
import android.widget.LinearLayout
import com.blankj.utilcode.util.ActivityUtils
import com.lxj.xpopup.core.CenterPopupView
import com.zhipu.balance.R
import com.zhipu.balance.listener.ChooseClickCallback

/**
 * 选择
 */
class ChoosePopup(var mChooseClickCallback : ChooseClickCallback) : CenterPopupView(ActivityUtils.getTopActivity()){


    override fun getImplLayoutId(): Int {
        return R.layout.popup_choose
    }


    override fun onCreate() {
        super.onCreate()
        /**
         * 关闭
         */
        findViewById<LinearLayout>(R.id.backdrop).setOnClickListener {
            dismiss()
        }
        /**
         * 功能计算-稻谷
         */
        findViewById<Button>(R.id.Rice).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(0)
        }
        /**
         * 小   麦
         */
        findViewById<Button>(R.id.Wheat).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(1)
        }
        /**
         * 玉   米
         */
        findViewById<Button>(R.id.Maize).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(2)
        }
        /**
         * 大   米
         */
        findViewById<Button>(R.id.DaMi).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(3)
        }
        /**
         * 大   豆
         */
        findViewById<Button>(R.id.Soybean).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(4)
        }
        /**
         * 油菜籽
         */
        findViewById<Button>(R.id.Rapeseed).setOnClickListener {
            dismiss()
            mChooseClickCallback.onChooseClickCallback(5)
        }

    }

}